#!usr/bin/python
# -*- coding:utf-8 -*-
import pymongo

class DbHelper(object):
    def __init__(self, type):
        self.conn = pymongo.MongoClient("192.168.2.100", 27017)

        if type == 'faceset':
            # test 表
            self.db = self.conn.db_test.faceset
        elif type == 'users':
            self.db = self.conn.db_test.users

    def getDataTable(self):
        return self.db

    def add(self, data):
        return self.db.save(data)

    def find_one(self, data):
        return self.db.find_one(data)

    def find(self):
        return self.db.find()

    def remove(self, data):
        return self.db.remove(data)


if __name__ == "__main__":
    result = DbHelper('users').add({})

    print result
